package com.hhh.petadopt.serviceImpl;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hhh.petadopt.mapper.PetLostMapper;
import com.hhh.petadopt.pojo.Lost;
import com.hhh.petadopt.service.PetLostService;
/**
 * 丢失动物处理
 * @author 杜镇声声
 *
 */
@Service
public class PetLostServiceImpl implements PetLostService {

	@Autowired
	private PetLostMapper petLostMapper;
	@Override
	public void savePetLostInfo(Lost lost) {
		//补全信息
		//丢失时间
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-mm-dd");
		Date date=new Date();
		String dateStr = sdf.format(date);
		try {
			Date mydate = sdf.parse(dateStr);
			lost.setLosttimee(mydate);
			
		} catch (Exception e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
		//状态的展示 表示展示,表示不展示
		lost.setLoststatus("2");
		//时间
		lost.setCreatedd(new Date());
		lost.setUpdated(new Date());
		//执行
		petLostMapper.savePet(lost);

	}

}
